package org.example.fanruan;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class MaxNumber {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("3.in")));
        int n = Integer.parseInt(in.readLine());
        String[] init = new String[n];
        for (int i = 0; i < n; i++) {
            init[i] = in.readLine();
        }
        Arrays.sort(init);
        StringBuilder builder = new StringBuilder();
        for (int i = init.length -1; i > 0; i--) {
            builder.append(init[i]);
        }
        System.out.println(builder);
    }

//    private void quickSort(int[] target,int left,int right){
//        int pivot = target[left];
//        int low = left + 1;
//        int high = right;
//        while (low < right) {
//            while (low <= right && ) {
//
//            }
//        }
//    }
}
